package com.ibeeking.found.common.enums;

public enum CrowdAttributeEnum {
    SHOP_HAS_TO_BUY("店铺有购买", 1),
    NO_SHOP_PURCHASE("店铺无购买", 2),
    SHOP_HAS_ADDITIONAL_PURCHASE("店铺有加购", 3),
    NO_ADDITIONAL_PURCHASE("店铺无加购", 4),
    SHOP_HAS_VISIT("店铺有访问", 5),
    SHOP_NO_VISIT("店铺无访问", 6),
    NUMBER_OF_EFFECTIVE_PURCHASES("有效购买次数", 7),
    EFFECTIVE_PURCHASE_AMOUNT("有效购买金额", 8),
    OFFICIAL_ACCOUNT("关注公众号", 9),
    CANCEL_OFFICIAL_ACCOUNT("取消关注公众号", 10),
    IS_IT_OFFICIAL_ACCOUNT_FAN("是否公众号粉丝", 11),
    NO_REFUND_ORDERS("无退款订单数", 12);

    private String attribute;
    private Integer code;

    CrowdAttributeEnum(String attribute, Integer code) {
        this.attribute = attribute;
        this.code = code;
    }

    public String getAttribute() {
        return attribute;
    }

    public Integer getCode() {
        return code;
    }

    public static String getAttributeByCode(Integer code) {
        for (CrowdAttributeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getAttribute();
            }
        }
        return null;
    }

    public static CrowdAttributeEnum getEnumByCode(Integer code) {
        for (CrowdAttributeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
